import {useRoutes} from 'react-router-dom'

// 导入4个组件
import Login from '../views/user/Login'
import Admin from "../views/admin/Admin";
import User from "../views/admin/User";
import Role from "../views/admin/Role";
import Power from "../views/admin/Power";
import Attachment from "../views/admin/Attachment";

function RouterView() {
    // 配置路由
    const routes = useRoutes([
        {path: "", element: <Login></Login>},
        {path: "/login", element: <Login></Login>},
        {path: "/admin/*", element: <Admin></Admin>,
            children:[
                {path:"system/user",element:<User></User>},
                {path:"system/role",element:<Role></Role>},
                {path:"system/power",element:<Power></Power>},
                {path:"system/attachment",element:<Attachment></Attachment>},
                ]
        }
    ])

    return (<>{routes}</>);
}

// 导出路由
export default RouterView;
